*Paper: Fiscal Rules, Corruption and Electoral Accountability - Replication Files

*NB: the version of rdrobust is: "version 9.1.0  2022-10-28" 
*which rdrobust

clear all
cap log close 
set more off


**Global files
global folder "/Users/tommasogiommoni/Dropbox/Determinants of corruption/Stability pact and corruption/Replication files JOP"


********************************************************************************
****----						Dataset open 					    	----**** 
********************************************************************************

use "$folder/Data/dataset_feb2024.dta", clear

**-- Global

global controls7 proportion_female_Elected_lag av_education_Elected_lag av_age_Elected_lag  victory_margin_lag term_limit_lag 
global covs_bandwidth anno_FE* 
global FE_regres anno id_provincia
global control_set $controls7 education_mayor_lag age_mayor_lag gender_mayor_lag
global cluster_regr codcom 

**-- Panel dataset

xtset codcom anno
fvset base 2012 anno

**-- Additional cleaning

keep  if population_anagrafe<10000

********************************************************************************
****----						Analysis 					    		----**** 
********************************************************************************

****---- All regions ----****

**-- Optimal bandwidth computation

  capture drop  Shouse_tax_ordinary* Scurrent_exp_PC* Scapital_ext_PC* Sprocurement_amount_PC* Scurrent_cappital_exp_PC* Bhouse_tax_ordinary* Bcurrent_exp_PC* Bcapital_ext_PC* Bprocurement_amount_PC* Bcurrent_cappital_exp_PC*
  capture drop band* sample* 
foreach var in house_tax_ordinary current_exp_PC capital_ext_PC procurement_amount_PC current_cappital_exp_PC {
qui rdrobust `var' P if population_anagrafe<10000 &  anno>2012 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA") , covs()
local band1=e(h_l)
qui rdrobust `var' P if population_anagrafe<10000 &  anno<2013 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA") , covs()
local band2=e(h_l)
local band=(`band1'+`band2')/2
display "`band'"
gen	B`var'=(`band1'+`band2')/2
gen S`var' = abs(P)<B`var'
gen	B`var'2=(`band1'+`band2')/1.33
gen S`var'2 = abs(P)<B`var'2
gen	B`var'3=(`band1'+`band2')/1.6
gen S`var'3 = abs(P)<B`var'3

}

**-- Analysis

qui reghdfe house_tax_ordinary S P T ST PT PS PST $control_set if Shouse_tax_ordinary==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres population_anagrafe_V##post_2012)
est store tab1_0_1
qui reghdfe current_exp_PC S P T ST PT PS PST $control_set if Scurrent_exp_PC==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_2_1
qui reghdfe capital_ext_PC S P T ST PT PS PST $control_set if Scapital_ext_PC==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_3_1
qui reghdfe procurement_amount_PC S P T ST PT PS PST $control_set if Sprocurement_amount_PC==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_4_1
qui reghdfe current_cappital_exp_PC S P T ST PT PS PST $control_set if Scurrent_cappital_exp_PC==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_5_1

qui reghdfe house_tax_ordinary S P T ST PT PS PST $control_set if Shouse_tax_ordinary2==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres population_anagrafe_V##post_2012)
est store tab2_0_1
qui reghdfe current_exp_PC S P T ST PT PS PST $control_set if Scurrent_exp_PC2==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_2_1
qui reghdfe capital_ext_PC S P T ST PT PS PST $control_set if Scapital_ext_PC2==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_3_1
qui reghdfe procurement_amount_PC S P T ST PT PS PST $control_set if Sprocurement_amount_PC2==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_4_1
qui reghdfe current_cappital_exp_PC S P T ST PT PS PST $control_set if Scurrent_cappital_exp_PC2==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_5_1

qui reghdfe house_tax_ordinary S P T ST PT PS PST $control_set if Shouse_tax_ordinary3==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres population_anagrafe_V##post_2012)
est store tab3_0_1
qui reghdfe current_exp_PC S P T ST PT PS PST $control_set if Scurrent_exp_PC3==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_2_1
qui reghdfe capital_ext_PC S P T ST PT PS PST $control_set if Scapital_ext_PC3==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_3_1
qui reghdfe procurement_amount_PC S P T ST PT PS PST $control_set if Sprocurement_amount_PC3==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_4_1
qui reghdfe current_cappital_exp_PC S P T ST PT PS PST $control_set if Scurrent_cappital_exp_PC3==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_5_1

****---- FCRs ----****

**-- Optimal bandwidth computation

  capture drop  Shouse_tax_ordinary* Scurrent_exp_PC* Scapital_ext_PC* Sprocurement_amount_PC* Scurrent_cappital_exp_PC* Bhouse_tax_ordinary* Bcurrent_exp_PC* Bcapital_ext_PC* Bprocurement_amount_PC* Bcurrent_cappital_exp_PC*
  capture drop band* sample* 
foreach var in house_tax_ordinary current_exp_PC capital_ext_PC procurement_amount_PC current_cappital_exp_PC {
qui rdrobust `var' P if population_anagrafe<10000 &  anno>2012 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA") , covs()
local band1=e(h_l)
qui rdrobust `var' P if population_anagrafe<10000 &  anno<2013 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA") , covs()
local band2=e(h_l)
local band=(`band1'+`band2')/2
display "`band'"
gen	B`var'=(`band1'+`band2')/2
gen S`var' = abs(P)<B`var'
gen	B`var'2=(`band1'+`band2')/1.33
gen S`var'2 = abs(P)<B`var'2
gen	B`var'3=(`band1'+`band2')/1.6
gen S`var'3 = abs(P)<B`var'3

}

**-- Analysis

qui reghdfe house_tax_ordinary S P T ST PT PS PST $control_set if Shouse_tax_ordinary==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres population_anagrafe_V##post_2012)
est store tab1_0_2
qui reghdfe current_exp_PC S P T ST PT PS PST $control_set if Scurrent_exp_PC==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_2_2
qui reghdfe capital_ext_PC S P T ST PT PS PST $control_set if Scapital_ext_PC==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_3_2
qui reghdfe procurement_amount_PC S P T ST PT PS PST $control_set if Sprocurement_amount_PC==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_4_2
qui reghdfe current_cappital_exp_PC S P T ST PT PS PST $control_set if Scurrent_cappital_exp_PC==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_5_2

qui reghdfe house_tax_ordinary S P T ST PT PS PST $control_set if Shouse_tax_ordinary2==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres population_anagrafe_V##post_2012)
est store tab2_0_2
qui reghdfe current_exp_PC S P T ST PT PS PST $control_set if Scurrent_exp_PC2==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_2_2
qui reghdfe capital_ext_PC S P T ST PT PS PST $control_set if Scapital_ext_PC2==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_3_2
qui reghdfe procurement_amount_PC S P T ST PT PS PST $control_set if Sprocurement_amount_PC2==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_4_2
qui reghdfe current_cappital_exp_PC S P T ST PT PS PST $control_set if Scurrent_cappital_exp_PC2==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_5_2

qui reghdfe house_tax_ordinary S P T ST PT PS PST $control_set if Shouse_tax_ordinary3==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres population_anagrafe_V##post_2012)
est store tab3_0_2
qui reghdfe current_exp_PC S P T ST PT PS PST $control_set if Scurrent_exp_PC3==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_2_2
qui reghdfe capital_ext_PC S P T ST PT PS PST $control_set if Scapital_ext_PC3==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_3_2
qui reghdfe procurement_amount_PC S P T ST PT PS PST $control_set if Sprocurement_amount_PC3==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_4_2
qui reghdfe current_cappital_exp_PC S P T ST PT PS PST $control_set if Scurrent_cappital_exp_PC3==1 &  FURs==0 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_5_2
  
****---- FCUs ----****

**-- Optimal bandwidth computation

  capture drop  Shouse_tax_ordinary* Scurrent_exp_PC* Scapital_ext_PC* Sprocurement_amount_PC* Scurrent_cappital_exp_PC* Bhouse_tax_ordinary* Bcurrent_exp_PC* Bcapital_ext_PC* Bprocurement_amount_PC* Bcurrent_cappital_exp_PC*
  capture drop band* sample* 
foreach var in house_tax_ordinary current_exp_PC capital_ext_PC procurement_amount_PC current_cappital_exp_PC {
qui rdrobust `var' P if anno>2012 & population_anagrafe<10000  &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA") , covs()
local band1=e(h_l)
qui rdrobust `var' P if anno<2013 & population_anagrafe<10000  &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA") , covs()
local band2=e(h_l)
local band=(`band1'+`band2')/2
display "`band'"
gen	B`var'=(`band1'+`band2')/2
gen S`var' = abs(P)<B`var'
gen	B`var'2=(`band1'+`band2')/1.33
gen S`var'2 = abs(P)<B`var'2
gen	B`var'3=(`band1'+`band2')/1.6
gen S`var'3 = abs(P)<B`var'3

}

**-- Analysis

qui reghdfe house_tax_ordinary S P T ST PT PS PST $control_set if Shouse_tax_ordinary==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres population_anagrafe_V##post_2012)
est store tab1_0_3
qui reghdfe current_exp_PC S P T ST PT PS PST $control_set if Scurrent_exp_PC==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_2_3
qui reghdfe capital_ext_PC S P T ST PT PS PST $control_set if Scapital_ext_PC==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_3_3
qui reghdfe procurement_amount_PC S P T ST PT PS PST $control_set if Sprocurement_amount_PC==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_4_3
qui reghdfe current_cappital_exp_PC S P T ST PT PS PST $control_set if Scurrent_cappital_exp_PC==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab1_5_3

qui reghdfe house_tax_ordinary S P T ST PT PS PST $control_set if Shouse_tax_ordinary2==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres population_anagrafe_V##post_2012)
est store tab2_0_3
qui reghdfe current_exp_PC S P T ST PT PS PST $control_set if Scurrent_exp_PC2==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_2_3
qui reghdfe capital_ext_PC S P T ST PT PS PST $control_set if Scapital_ext_PC2==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_3_3
qui reghdfe procurement_amount_PC S P T ST PT PS PST $control_set if Sprocurement_amount_PC2==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_4_3
qui reghdfe current_cappital_exp_PC S P T ST PT PS PST $control_set if Scurrent_cappital_exp_PC2==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab2_5_3

qui reghdfe house_tax_ordinary S P T ST PT PS PST $control_set if Shouse_tax_ordinary3==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres population_anagrafe_V##post_2012)
est store tab3_0_3
qui reghdfe current_exp_PC S P T ST PT PS PST $control_set if Scurrent_exp_PC3==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_2_3
qui reghdfe capital_ext_PC S P T ST PT PS PST $control_set if Scapital_ext_PC3==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_3_3
qui reghdfe procurement_amount_PC S P T ST PT PS PST $control_set if Sprocurement_amount_PC3==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_4_3
qui reghdfe current_cappital_exp_PC S P T ST PT PS PST $control_set if Scurrent_cappital_exp_PC3==1 &  FURs==1 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), cluster($cluster_regr) absorb($FE_regres)
est store tab3_5_3
 
****---- Table ----**** 

esttab tab1_0_1 tab1_2_1 tab1_3_1 tab1_4_1 tab1_5_1 using "$folder/Tables/TableA15_panelA.tex", compress keep(ST) se r2 staraux collabels(, none) ml(,none) cells(b(star fmt (%9.3f)) se(par)) star(* 0.10 ** 0.05 *** 0.01) replace
esttab tab1_0_2 tab1_2_2 tab1_3_2 tab1_4_2 tab1_5_2 using "$folder/Tables/TableA15_panelB.tex", compress keep(ST) se r2 staraux collabels(, none) ml(,none) cells(b(star fmt (%9.3f)) se(par)) star(* 0.10 ** 0.05 *** 0.01) replace
esttab tab1_0_3 tab1_2_3 tab1_3_3 tab1_4_3 tab1_5_3 using "$folder/Tables/TableA15_panelC.tex", compress keep(ST) se r2 staraux collabels(, none) ml(,none) cells(b(star fmt (%9.3f)) se(par)) star(* 0.10 ** 0.05 *** 0.01) replace

esttab tab3_0_1 tab3_2_1 tab3_3_1 tab3_4_1 tab3_5_1 using "$folder/Tables/TableA16_panelA.tex", compress keep(ST) se r2 staraux collabels(, none) ml(,none) cells(b(star fmt (%9.3f)) se(par)) star(* 0.10 ** 0.05 *** 0.01) replace
esttab tab3_0_2 tab3_2_2 tab3_3_2 tab3_4_2 tab3_5_2 using "$folder/Tables/TableA16_panelB.tex", compress keep(ST) se r2 staraux collabels(, none) ml(,none) cells(b(star fmt (%9.3f)) se(par)) star(* 0.10 ** 0.05 *** 0.01) replace
esttab tab3_0_3 tab3_2_3 tab3_3_3 tab3_4_3 tab3_5_3 using "$folder/Tables/TableA16_panelC.tex", compress keep(ST) se r2 staraux collabels(, none) ml(,none) cells(b(star fmt (%9.3f)) se(par)) star(* 0.10 ** 0.05 *** 0.01) replace

esttab tab2_0_1 tab2_2_1 tab2_3_1 tab2_4_1 tab2_5_1 using "$folder/Tables/TableA17_panelA.tex", compress keep(ST) se r2 staraux collabels(, none) ml(,none) cells(b(star fmt (%9.3f)) se(par)) star(* 0.10 ** 0.05 *** 0.01) replace
esttab tab2_0_2 tab2_2_2 tab2_3_2 tab2_4_2 tab2_5_2 using "$folder/Tables/TableA17_panelB.tex", compress keep(ST) se r2 staraux collabels(, none) ml(,none) cells(b(star fmt (%9.3f)) se(par)) star(* 0.10 ** 0.05 *** 0.01) replace
esttab tab2_0_3 tab2_2_3 tab2_3_3 tab2_4_3 tab2_5_3 using "$folder/Tables/TableA17_panelC.tex", compress keep(ST) se r2 staraux collabels(, none) ml(,none) cells(b(star fmt (%9.3f)) se(par)) star(* 0.10 ** 0.05 *** 0.01) replace
